![]() |
CalcCMask |
||||
Header: | Quickdraw.h | Carbon status: | Supported | |
Determines where filling will not occur when filling from the outside of a rectangle.
void CalcCMask ( const BitMap *srcBits, const BitMap *dstBits, const Rect *srcRect, const Rect *dstRect, const RGBColor *seedRGB, ColorSearchUPP matchProc, SInt32 matchData );
The source image. If the image is in a pixel map, you must coerce its PixMap structure to a BitMap structure.
The destination image. The CalcCMask function returns the generated bitmap mask in this parameter. You can then use this mask with the CopyBits, CopyMask, and CopyDeepMask functions.
The rectangle of the source image.
The rectangle of the destination image.
An RGBColor structure specifying the color for pixels that should not be filled.
An optional matching function.
Data for the optional matching function.
Specify a source image in the srcBits parameter and in the srcRect parameter, specify a rectangle within that source image. Starting from the edges of this rectangle, CalcCMask calculates which pixels cannot be filled. By default, CalcCMask returns 1’s in the mask to indicate which pixels have the exact color that you specify in the seedRGB parameter and which pixels are enclosed by shapes whose outlines consist entirely of pixels with this color.
For instance, if the source image in srcBits contains a dark blue rectangle on a red background, and your application sets seedRGB equal to dark blue, then CalcCMask returns a mask with 1’s in the positions corresponding to the edges and interior of the rectangle, and the 0’s outside of the rectangle.
If you set the matchProc and matchData parameters to 0, CalcCMask uses the exact color specified in the RGBColor structure that you supply in the seedRGB parameter. You can customize CalcCMask by writing your own color search function and pointing to it in the matchProc parameter. As with SeedCFill, you can then use the matchData parameter in any manner useful for your application.
The CalcCMask function does not scale so the source and destination rectangles must be the same size. Calls to CalcCMask are not clipped to the current port and are not stored into QuickDraw pictures.
Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)